package com.saksfifthavenue;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.archive.crawler.datamodel.CandidateURI;
import org.archive.crawler.extractor.Link;
import org.archive.crawler.postprocessor.FrontierScheduler;
import org.archive.io.ReplayCharSequence;
import org.archive.util.HttpRecorder;


public class SaksfifthavenueFrontierScheduler extends FrontierScheduler{

	/**
	 * 
	 */
	public static final String pattern_ahref = "<a\\s+href\\s*=\\s*(\"([^\"]*)\"|[^\\s>])\\s*>";
	public static final String jd = "http://news.sohu.com/[\\d]+/n[\\d]+.shtml";

	public SaksfifthavenueFrontierScheduler(String name) {
		super(name);
		// TODO Auto-generated constructor stub
	}
	
	protected void schedule(CandidateURI curi){
		
		String url=curi.toString();
		if (url.endsWith(".zip") || url.endsWith(".rar") || url.endsWith(".exe") || url.endsWith(".pdf")  || url.endsWith(".doc") 
			|| url.endsWith(".xls") || url.endsWith(".css") ||url.endsWith(".js"))
		{  
			return;  
		} 
		
//		if(url.equals("dns:www.saksfifthavenue.com"))
//			this.getController().getFrontier().schedule(curi);
//		
		//System.out.println("SaksfifthavenueFrontierScheduler֮ǰ :"+url);
		
//		String reg="http://www.saksfifthavenue.com/search/EndecaSearch.jsp(.*?)";
//		String reg1="http://www.saksfifthavenue.com/main/ProductDetail.jsp(.*?)";
//		
//		Matcher mat1 = Pattern.compile(reg).matcher(curi.toString());
//		if(mat1.find())
//		{
//			System.out.println("SaksfifthavenueFrontierScheduler    :"+url);
//			this.getController().getFrontier().schedule(curi);
//		}
//		
//		Matcher mat = Pattern.compile(reg1).matcher(curi.toString());
//		if(mat.find())
//		{
//			System.out.println("SaksfifthavenueFrontierScheduler    :"+url);
			this.getController().getFrontier().schedule(curi);
//		}

	}
	
	

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
